<div class="user-view">
	<h2><?php echo __('Training for', true). ' ' . $user['User']['username']; ?></h2>
	<div class="holder">
		Profile and latest workouts
	</div>
</div>
<div class="actions">
	<ul>
		<li><?php echo $html->link(__('Edit User', true), array('action' => 'edit', $user['User']['id'])); ?> </li>
		<li><?php echo $html->link(__('Delete User', true), array('action' => 'delete', $user['User']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $user['User']['id'])); ?> </li>
		<li><?php echo $html->link(__('List Users', true), array('action' => 'index')); ?> </li>
		<li><?php echo $html->link(__('New User', true), array('action' => 'add')); ?> </li>
		<li><?php echo $html->link(__('List Templates', true), array('controller' => 'templates', 'action' => 'index')); ?> </li>
		<li><?php echo $html->link(__('New Template', true), array('controller' => 'templates', 'action' => 'add')); ?> </li>
		<li><?php echo $html->link(__('List Types', true), array('controller' => 'types', 'action' => 'index')); ?> </li>
		<li><?php echo $html->link(__('New Type', true), array('controller' => 'types', 'action' => 'add')); ?> </li>
		<li><?php echo $html->link(__('List Workouts', true), array('controller' => 'workouts', 'action' => 'index')); ?> </li>
		<li><?php echo $html->link(__('New Workout', true), array('controller' => 'workouts', 'action' => 'add')); ?> </li>
	</ul>
</div>
<div class="related">
	<h3><?php __('Related Templates');?></h3>
	<?php if (!empty($user['Template'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('User Id'); ?></th>
		<th><?php __('Type Id'); ?></th>
		<th><?php __('Title'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($user['Template'] as $template):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $template['id'];?></td>
			<td><?php echo $template['user_id'];?></td>
			<td><?php echo $template['type_id'];?></td>
			<td><?php echo $template['title'];?></td>
			<td class="actions">
				<?php echo $html->link(__('View', true), array('controller' => 'templates', 'action' => 'view', $template['id'])); ?>
				<?php echo $html->link(__('Edit', true), array('controller' => 'templates', 'action' => 'edit', $template['id'])); ?>
				<?php echo $html->link(__('Delete', true), array('controller' => 'templates', 'action' => 'delete', $template['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $template['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $html->link(__('New Template', true), array('controller' => 'templates', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
<div class="related">
	<h3><?php __('Related Types');?></h3>
	<?php if (!empty($user['Type'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('User Id'); ?></th>
		<th><?php __('Title'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($user['Type'] as $type):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $type['id'];?></td>
			<td><?php echo $type['user_id'];?></td>
			<td><?php echo $type['title'];?></td>
			<td class="actions">
				<?php echo $html->link(__('View', true), array('controller' => 'types', 'action' => 'view', $type['id'])); ?>
				<?php echo $html->link(__('Edit', true), array('controller' => 'types', 'action' => 'edit', $type['id'])); ?>
				<?php echo $html->link(__('Delete', true), array('controller' => 'types', 'action' => 'delete', $type['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $type['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $html->link(__('New Type', true), array('controller' => 'types', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
<div class="related">
	<h3><?php __('Related Workouts');?></h3>
	<?php if (!empty($user['Workout'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('User Id'); ?></th>
		<th><?php __('Template Id'); ?></th>
		<th><?php __('Date'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($user['Workout'] as $workout):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $workout['id'];?></td>
			<td><?php echo $workout['user_id'];?></td>
			<td><?php echo $workout['template_id'];?></td>
			<td><?php echo $workout['date'];?></td>
			<td class="actions">
				<?php echo $html->link(__('View', true), array('controller' => 'workouts', 'action' => 'view', $workout['id'])); ?>
				<?php echo $html->link(__('Edit', true), array('controller' => 'workouts', 'action' => 'edit', $workout['id'])); ?>
				<?php echo $html->link(__('Delete', true), array('controller' => 'workouts', 'action' => 'delete', $workout['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $workout['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $html->link(__('New Workout', true), array('controller' => 'workouts', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
